﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<UserViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Details
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Profile</h2>

<fieldset>
    <legend><%: Html.DisplayFor(model => model.Firstname) %> <%: Html.DisplayFor(model => model.Lastname) %></legend>

    <div id="Photo">
        <img src="../../Content/profilfoto.gif" alt="profilfoto" />
    </div>

    <div id="Data">

        <div class="display-label">Mail</div>
        <div class="display-field">
            <%: Html.DisplayFor(model => model.Mail) %>
        </div>

        <div class="display-label">FirstName</div>
        <div class="display-field">
            <%: Html.DisplayFor(model => model.Firstname) %>
        </div>

        <div class="display-label">LastName</div>
        <div class="display-field">
            <%: Html.DisplayFor(model => model.Lastname) %>
        </div>

        <div class="display-label">Birthday</div>
        <div class="display-field">
            <%: Html.DisplayFor(model => model.Birthday) %>
        </div>

    </div>

</fieldset>

<fieldset>
    <legend>My Events</legend>

    <div id="Div1">
        <table>
            <tr>
                <th>
                    When
                </th>
                <th>
                    Event
                </th>
                <th>
                    Attendance
                </th>
            </tr>

        <% foreach (var item in Model.UserEventAttendance) { %>
            <tr>
                <td>
                    <%: item.Event.StartDate +" - "+ item.Event.EndDate %>
                </td>
                <td>
                    <%: Html.ActionLink(item.Event.Title, "Details", "Event", new { id = item.Event.Id }, null) %>
                </td>
                <td>
                   <%: item.Attendance %>
                </td>
            </tr>  
        <% } %>

        </table>
    </div>

</fieldset>

<p>

    <% if (Model.isLoggedInAdmin || Model.loggedInUserId == Model.Id) 
    { %>
        <%: Html.ActionLink("Edit", "Edit", new { id=Model.Id }) %> 
    <% } %>
    <% if (Model.isLoggedInAdmin)
       { %>
        | <%: Html.ActionLink("Back to List", "Index")%>
    <% } %>
</p>

</asp:Content>
